package java8_11;

/**
 * @author oldliu
 * @since 1.0
 */
public class BubbleSort {
    //冒泡排序
    public static void main(String[] args) {
        int[]ar={45,77,33,23,14,66,63,25,70};
        for(int i=0;i<ar.length-1;i++){
            for(int j=0;j<ar.length-1-i;j++){
                //隔壁判断
                if(ar[j]>ar[j+1]){//j最大是 ar.length-2.小心越界
                    int temp=ar[j];
                    ar[j]=ar[j+1];
                    ar[j+1]=temp;
                }
            }
        }
        System.out.println("排序后:");
        for(int i:ar){
            System.out.print(i+"\t");
        }
    }
}
